{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "悟空的兵器是金箍棒，重十万八千金，一般人都举不动\n",
      "八戒的兵器是九齿钉耙，就是一般的兵器\n",
      "悟净的兵器是降妖宝杖，因为没怎么用过，所以不知道有多重\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(None, None, None)"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "class WestTeam(object):\n",
    "    \n",
    "    def __init__(self,name,weapon):\n",
    "        self.name = name\n",
    "        self.weappon = weapon\n",
    "        \n",
    "    def weapon_use(self):\n",
    "        print(f'{self.name}的兵器是{self.weappon}')\n",
    "        \n",
    "        \n",
    "        \n",
    "class WuKong(WestTeam):\n",
    "    \n",
    "    def __init__(self,name,weapon):\n",
    "        super().__init__(name,weapon)\n",
    "        self.name = name\n",
    "        self.weappon = weapon\n",
    "        \n",
    "    def weapon_use(self):\n",
    "        print(f'{self.name}的兵器是{self.weappon}，重十万八千金，一般人都举不动')\n",
    "\n",
    "class BaJie(WestTeam):\n",
    "    \n",
    "    def __init__(self,name,weapon):\n",
    "        super().__init__(name,weapon)\n",
    "        self.name = name\n",
    "        self.weappon = weapon\n",
    "        \n",
    "    def weapon_use(self):\n",
    "        print(f'{self.name}的兵器是{self.weappon}，就是一般的兵器')\n",
    "        \n",
    "class WuJing(WestTeam):\n",
    "    \n",
    "    def __init__(self,name,weapon):\n",
    "        super().__init__(name,weapon)\n",
    "        self.name = name\n",
    "        self.weappon = weapon\n",
    "        \n",
    "    def weapon_use(self):\n",
    "        print(f'{self.name}的兵器是{self.weappon}，因为没怎么用过，所以不知道有多重')\n",
    "        \n",
    "        \n",
    "wukong = WuKong('悟空','金箍棒')\n",
    "bajie = BaJie('八戒','九齿钉耙')\n",
    "wujing = WuJing('悟净','降妖宝杖')\n",
    "\n",
    "wukong.weapon_use(),bajie.weapon_use(),wujing.weapon_use()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'weapon_use']\n"
     ]
    }
   ],
   "source": [
    "print(dir(WestTeam))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on class Exception in module builtins:\n",
      "\n",
      "class Exception(BaseException)\n",
      " |  Common base class for all non-exit exceptions.\n",
      " |  \n",
      " |  Method resolution order:\n",
      " |      Exception\n",
      " |      BaseException\n",
      " |      object\n",
      " |  \n",
      " |  Methods defined here:\n",
      " |  \n",
      " |  __init__(self, /, *args, **kwargs)\n",
      " |      Initialize self.  See help(type(self)) for accurate signature.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Static methods defined here:\n",
      " |  \n",
      " |  __new__(*args, **kwargs) from builtins.type\n",
      " |      Create and return a new object.  See help(type) for accurate signature.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from BaseException:\n",
      " |  \n",
      " |  __delattr__(self, name, /)\n",
      " |      Implement delattr(self, name).\n",
      " |  \n",
      " |  __getattribute__(self, name, /)\n",
      " |      Return getattr(self, name).\n",
      " |  \n",
      " |  __reduce__(...)\n",
      " |      Helper for pickle.\n",
      " |  \n",
      " |  __repr__(self, /)\n",
      " |      Return repr(self).\n",
      " |  \n",
      " |  __setattr__(self, name, value, /)\n",
      " |      Implement setattr(self, name, value).\n",
      " |  \n",
      " |  __setstate__(...)\n",
      " |  \n",
      " |  __str__(self, /)\n",
      " |      Return str(self).\n",
      " |  \n",
      " |  with_traceback(...)\n",
      " |      Exception.with_traceback(tb) --\n",
      " |      set self.__traceback__ to tb and return self.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors inherited from BaseException:\n",
      " |  \n",
      " |  __cause__\n",
      " |      exception cause\n",
      " |  \n",
      " |  __context__\n",
      " |      exception context\n",
      " |  \n",
      " |  __dict__\n",
      " |  \n",
      " |  __suppress_context__\n",
      " |  \n",
      " |  __traceback__\n",
      " |  \n",
      " |  args\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(Exception)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'\\n    \\n    这是一个关于西天取经小队的类\\n    \\n    '"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "WestTeam.__doc__"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on class Exception in module builtins:\n",
      "\n",
      "class Exception(BaseException)\n",
      " |  Common base class for all non-exit exceptions.\n",
      " |  \n",
      " |  Method resolution order:\n",
      " |      Exception\n",
      " |      BaseException\n",
      " |      object\n",
      " |  \n",
      " |  Methods defined here:\n",
      " |  \n",
      " |  __init__(self, /, *args, **kwargs)\n",
      " |      Initialize self.  See help(type(self)) for accurate signature.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Static methods defined here:\n",
      " |  \n",
      " |  __new__(*args, **kwargs) from builtins.type\n",
      " |      Create and return a new object.  See help(type) for accurate signature.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from BaseException:\n",
      " |  \n",
      " |  __delattr__(self, name, /)\n",
      " |      Implement delattr(self, name).\n",
      " |  \n",
      " |  __getattribute__(self, name, /)\n",
      " |      Return getattr(self, name).\n",
      " |  \n",
      " |  __reduce__(...)\n",
      " |      Helper for pickle.\n",
      " |  \n",
      " |  __repr__(self, /)\n",
      " |      Return repr(self).\n",
      " |  \n",
      " |  __setattr__(self, name, value, /)\n",
      " |      Implement setattr(self, name, value).\n",
      " |  \n",
      " |  __setstate__(...)\n",
      " |  \n",
      " |  __str__(self, /)\n",
      " |      Return str(self).\n",
      " |  \n",
      " |  with_traceback(...)\n",
      " |      Exception.with_traceback(tb) --\n",
      " |      set self.__traceback__ to tb and return self.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors inherited from BaseException:\n",
      " |  \n",
      " |  __cause__\n",
      " |      exception cause\n",
      " |  \n",
      " |  __context__\n",
      " |      exception context\n",
      " |  \n",
      " |  __dict__\n",
      " |  \n",
      " |  __suppress_context__\n",
      " |  \n",
      " |  __traceback__\n",
      " |  \n",
      " |  args\n",
      "\n"
     ]
    }
   ],
   "source": [
    "err = Exception('123')\n",
    "help(type(err))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['weapon_use']"
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[d for d in dir(WestTeam) if not d.startswith('_')]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
